package cn.itcast.demo6.web;

import cn.itcast.demo6.pojo.Purse;
import cn.itcast.demo6.service.PurseService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.sql.Wrapper;

/**
 * ClassName: PurseController
 * Package: com.itcast.demo5.controller
 * Description:
 *
 * @Author MLH
 * @Create 2023/4/18 9:27
 * @Version 1.0
 */
@RestController
@RequestMapping("/purse")
public class PurseController {

    @Autowired
    private PurseService purseService;

    /**
     * 查询个人账户余额
     * @param id
     * @return 根据用户所查询的余额信息
     */
    @GetMapping("/{id}")
    public Object getInfo(@PathVariable("id") int id){ //通过用户id调用接口
        QueryWrapper<Purse> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", id);
        return purseService.getOne(queryWrapper);
    }



}
